package com.geek.gkpush.framework.retry.enums;

/**
 * <h1>重试任务执行状态枚举类。</h1><br/>
 *
 * <h1><br/><a href="https://u.geekbang.org/subject/arch3/100614201">Java 业务架构实战营：https://u.geekbang.org/subject/arch3/100614201</a></h1><br/><h1><a href="https://gitee.com/ylimhhmily/BizArchPracticeCamp">Java 业务架构实战营代码地址：https://gitee.com/ylimhhmily/BizArchPracticeCamp</a></h1><br/><h1><a href="https://u.geekbang.org/subject/java4th/1001148?source=app_share">高级 Java 工程体系课 2023 版：https://u.geekbang.org/subject/java4th/1001148?source=app_share</a></h1><br/><h1><a href="https://time.geekbang.org/column/intro/100312101?tab=catalog">Dubbo 源码剖析与实战：https://time.geekbang.org/column/intro/100312101?tab=catalog</a></h1>
 *
 * @author hmilyylimh
 * ^_^
 * @version 0.0.1
 * ^_^
 * @date 2023/9/23 21:46
 */
public enum ExecStatusEnum {

    /** <h2>"INIT", "初始化"</h2> **/
    INIT("INIT", "初始化"),

    /** <h2>"ING", "处理中"</h2> **/
    ING("ING", "处理中"),

    /** <h2>"FAIL", "失败"</h2> **/
    FAIL("FAIL", "失败"),

    /** <h2>"SUCC", "成功"</h2> **/
    SUCC("SUCC", "成功"),
    ;

    private String code;
    private String msg;

    ExecStatusEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * <h2>是否是成功状态。</h2>
     *
     * @param: execStatus
     * @return: <h2>{@code true}：是成功状态；{@code false}：不是成功状态。</h2>
     */
    public static boolean isSucc(String execStatus) {
        return SUCC.getCode().equals(execStatus);
    }

    /**
     * <h2>是否是正在执行中。</h2>
     *
     * @param: execStatus
     * @return: <h2>{@code true}：正在执行中；{@code false}：没有在执行中。</h2>
     */
    public static boolean isRunning(String execStatus) {
        return ING.getCode().equals(execStatus);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}